
{% extends 'layout/index.html' %}

{% load custom_tag %}

{% block css %}
    <link rel="stylesheet" type="text/css" href="/static/plugins/DataTables/datatables.min.css"/>
{% endblock %}

{% block conent %}


{#        <div class="panel-body">#}
{#            <table class="table ">#}
{#                <thead>#}
{#                    <tr>#}
{#                        <th>Session ID</th>#}
{#                        <th>堡垒机用户</th>#}
{#                        <th>登录时间</th>#}
{#                        <th>登录主机</th>#}
{#                        <th>登录用户名</th>#}
{#                        <th>停留时间</th>#}
{#                        <th>执行命令数</th>#}
{#                    </tr>#}
{#                </thead>#}
{##}
{#                <tbody>#}
{#                     {% for session_obj in session_objs %}#}
{#                         <tr>#}
{#                             <td><a class="btn-link"   href="{% url 'audit_log_cmd' session_obj.id %}" > {{ session_obj.id }} </a> </td>#}
{#                             <td>{{ session_obj.user.name }}</td>#}
{#                             <td>{{ session_obj.date }}</td>#}
{#                             <td>{{ session_obj.bind_host.host.manage_ip }}</td>#}
{#                             <td>{{ session_obj.bind_host.remote_user }}</td>#}
{#                             <td>{{ session_obj.stay_time }}</td>#}
{#                             <td>{{ session_obj.cmd_count }}</td>#}
{#                         </tr>#}
{#                     {% endfor %}#}
{##}
{#                </tbody>#}
{#            </table>#}
{#        </div>#}
{#    </div>#}

    <ol class="breadcrumb">
      <li  > <a href="{% url 'audit_session' %}">审计会话</a></li>
      <li  class="active">审计命令</li>
    </ol>

    <div class="panel-body" >

           <div class="table-responsive">

                <table id="asset_list" class=" table  table-hover">
                  <thead >
                        <tr class="">
                            {% for column in table_obj.list_display %}
                            <th class="column-sorted">
                                <a href="?page={{ table_obj.query_sets.number }}&orderby={% if table_obj.orderby_col_index == forloop.counter0 %}{{ table_obj.orderby_field}}{% else %}{{ column }}{% endif %}&page_num={%  get_field_page_num request %}" >
                                    {% get_table_column column table_obj %}
                                    {% display_orderby_arrow table_obj forloop.counter0 %}

                                </a>
                            </th>

                            {% endfor %}
                            {% for column in table_obj.dynamic_list_display %}
                                <th class="column-sorted">
                                    <a href="#" >
{#                                        {% get_fk_table_column column table_obj %}#}
                                        {{ column }}
                                        {% display_orderby_arrow table_obj forloop.counter0 %}

                                    </a>
                                </th>
                            {% endfor %}

                            <!-- display m2m colums-->
                            {% for column in table_obj.m2m_fields %}
                                <th class="">{{  column }}</th>
                            {% endfor %}

                        </tr>
                    </thead>

                    <tbody>
                        {% for row in table_obj.query_sets %}
{#                            <tr>{{ forloop.counter }}</tr>#}
                            <tr>
                                {% build_table_row  row table_obj 'id'  'audit_cmd'  %}
                            </tr>
                        {% endfor %}

                    </tbody>

                    <tr>
                            <td colspan="12" class="footable-visible">


{#                                {{  request.get_full_path }}﻿﻿#}


                                <div class="pagination">

                                    <nav>
                                    <form id="my_form" method="get" action="">
                                            <input type="hidden" name="action" value="paging" />
{#                                                  通过隐藏表单，发送 http://127.0.0.1:8000/host/audit_cmd/16/?action=paging&orderby=id&page_num=50 #}
                                            <input type="hidden" name="orderby" value="{%  get_field_order_by request %}">


                                             每页显示：
                                            <select onchange="submitForm();" name="page_num" >
{#                                                <option value="10">10</option>#}
{#                                                <option value="50" >20</option>#}
{#                                                <option value="100">30</option>#}
                                                  {% paging_filed_selected  page_number %}


                                            </select> 条,
                                             <span>共{{ paginator.count }}条数据</span>
                                    </form>

                                        <ul class="pagination">
                                            {% if table_obj.query_sets.has_previous %}
                                            <li class="disabled">
                                                <a href="{{ request.get_full_path }}?page={{ table_obj.query_sets.previous_page_number }}" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
                                            </li>
                                            {% endif %}
                                            {% for p_num in paginator.page_range %}
                                                {% render_page_num request table_obj.query_sets p_num %}
                                            {% endfor %}
                                            {% if customer_list.has_next %}
                                            <li>
                                              <a href="{{ request.get_full_path }}?page={{ table_obj.query_sets.next_page_number }}" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                              </a>
                                            </li>
                                            {% endif %}
                                        </ul>
                                    </nav>

                                </div>    <!--end pagination-->
                            </td>
                    </tr>

                </table>

           </div> <!--end table-responsive-->

    </div>




{% endblock %}

{% block js %}

    <script>
         function submitForm()  {
                  var form = document.getElementById("my_form"); //获取form表单对象
                  form.submit(); //form表单提交
         }


    </script>






{% endblock %}